<!--  -->
<template>
  <div class='' v-loading='zhengqi_table_loading' style="min-height:500px" v-no-data='no_data'>
    <div :class="['list_table',item.isSinglePrice==='1'?'danyi':'jieti']" v-for="(item,index) in zhengqi_table" :key='index'>
      <div :class="[{'disMark-row':item.disMark==='1'},item.isSinglePrice==='1'?'danyi':'jieti']"></div>
      <div :class="['list_title',{'disMark-row':item.disMark==='1'}]" @click='list_show_click(item,index)'>
        <div class=''>
          开始执行日期：<b>{{item.startExecuteDate}}</b>
        </div>
        <div>
          计费方式：<b>{{item.isSinglePrice |isSinglePrice}}</b>
        </div>
        <div v-if="item.disMark==='1'">
          <el-button size='mini' type="primary">已废弃</el-button>
        </div>
        <div v-else>
          <el-button v-show='item.discard' type="primary" size='mini' @click.stop='editor(item)'>编辑</el-button>
          <el-button v-show='item.discard' type="danger" size='mini' @click.stop='abandoned(item)'>废弃</el-button>
        </div>
        <!-- </div> -->
      </div>
      <div :class="['list',{'disMark-row':item.disMark==='1'}]" v-if="item.isSinglePrice !=='1'">
        <div>蒸汽压力：<b>{{item.price[0].pressure|pressure}}</b></div>
        <div class='r' v-for="(item,index) in item.price[0].ladders" :key='index'>
          <span v-if='item.end ===null'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;末档：<b>{{item.start}}</b></span>
          <span v-else>第 {{num(index+1)}} 档：<b>{{item.start}} ~ {{item.end}}</b></span>
          <span>单价<b>{{item.price}}</b><i>元/t</i></span>
        </div>
      </div>
      <div :class="['list',{'disMark-row':item.disMark==='1'}]" v-else>
        <div>蒸汽压力<b>{{item.price[0].pressure|pressure}}</b><i></i></div>
        <div>单价<b>{{item.price[0].ladders[0].price}}</b><i>元/t</i></div>
      </div>
    </div>
  </div>
</template>

<script>
import './index.scss'
export default {
  name: 'zhaoxiongfei',
  data() {
    return {
      no_data: false,
      zhengqi_table_loading: true,
      zhengqi_table: []
      // ========== () ==========
      // ========== () ==========
      // ========== () ==========
      // ========== () ==========
      // ========== () ==========
      // ========== () ==========
      // ========== () ==========
      // ========== () ==========
      // ========== () ==========
      // ========== () ==========
      // ========== () ==========
      // ========== () ==========
      // ========== () ==========
      // ========== () ==========
      // ========== () ==========
    }
  },
  created() {
    this.initList()

  },
  methods: {
    initList() {
      // 获取list数据
      this.$axios
        .post(this.Eelec + "/energy/info/manage/list", {
          custId: sessionStorage.getItem("custId"),
          date: '',
          energyType: '02',
          billType: '1'
        })
        .then(res => {
          this.zhengqi_table_loading = false
          if (res.data.data.steamPurchaseList !== null && res.data.data.steamPurchaseList.length) {
            this.zhengqi_table = res.data.data.steamPurchaseList
          } else {
            this.zhengqi_table = []
            this.no_data = true
          }
        }).catch((err) => {
          this.zhengqi_table = []

        })
    },
    list_show_click(item, index) {
      for (let i = 0; i < this.zhengqi_table.length; i++) {
        this.zhengqi_table[i].isOpen = false
      }
      this.zhengqi_table[index].isOpen = true
    },
    num(n) {
      switch (n) {
        case 1:
          return '一';
          break;
        case 2:
          return '二';
          break;
        case 3:
          return '三';
          break;
        case 4:
          return '四';
          break;
        case 5:
          return '五';
          break;
        case 6:
          return '六';
          break;
        case 7:
          return '七';
          break;
        case 8:
          return '八';
          break;
        case 9:
          return '九';
          break;
        default:
          return n
      }
    },
    // ========== () ==========
    // ========== () ==========
    // ========== () ==========
    // ========== () ==========
    // ========== () ==========
    // ========== () ==========
    // ========== () ==========
    // ========== () ==========
    // ========== () ==========
    // ========== () ==========
  },
  mounted() { },
  components: {},
  filters: {
    pressure: function (a) {
      if (a === '01') {
        return '低压'
      } else if (a === '02') {
        return '中压'
      } else if (a === '03') {
        return '高压'
      } else {
        return a
      }
    },
    isSinglePrice: function (a) {
      if (a === '1') {
        return '单一计费'
      } else if (a === '2') {
        return '分段累计阶梯计费'
      } else if (a === '3') {
        return '按月总量阶梯计费'
      } else {
        return a
      }
    },
  }
}

</script>

<style lang='' scoped>
</style>